<?php
/**
 * Unfuddle Backup Model
 * Project data backups are represented by this model.
 *
 * @package     Unfuddle
 * @subpackage  Data Models
 * @author      Luke Visinoni <luke.visinoni@gmail.com>
 * @copyright   (c) 2010 Luke Visinoni <luke.visinoni@gmail.com>
 * @version     $Id: Backup.php 29 2011-05-09 07:08:53Z luke.visinoni $
 */
class Unfuddle_Model_Backup extends Unfuddle_Model_Abstract {

    /**
     * The collection represents any user requested Backups within the given Project.
     */
    const URI_PROJECT_BACKUPS = '/project/%d/backups';
    
    /**
     * Access to a particular backup by project id and backup id
     */
    const URI_PROJECT_BACKUP_BY_ID = '/projects/%d/backups/%d';
    
    /**
     * Download a backup in its entirety (for backups under 1800MB)
     */
    const URI_PROJECT_BACKUP_DOWNLOAD = '/projects/%d/backups/%d/download';
    
    /**
     * Backups that exceed 1800MB must be downloaded in parts and concatenated
     * before being unarchived
     */
    const URI_PROJECT_BACKUP_DOWNLOAD_PART = '/projects/%d/backups/%d/parts/%d/download';

    /**
     * @var string Model name
     */
    protected $_name = 'backup';
    
    /**
     * @var array Model fields
     */
    protected $_fields = array(
        'created-at' => array('type' => 'datetime', 'required' => false, 'read-only' => true),
        'id' => array('type' => 'integer', 'required' => false, 'read-only' => true),
        'parts' => array('type' => 'integer', 'required' => false, 'read-only' => true),
        'processed' => array('type' => 'boolean', 'required' => false, 'read-only' => true),
        'processed-at' => array('type' => 'datetime', 'required' => false, 'read-only' => true),
        'project-id' => array('type' => 'integer', 'required' => false, 'read-only' => true),
        'requester-id' => array('type' => 'integer', 'required' => false, 'read-only' => true),
    );

}
